package com.t235.gc.biz.service.impl;

import com.t235.gc.entity.Venues;
import com.t235.gc.dao.VenuesDao;
import com.t235.gc.biz.service.VenuesService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 场地表(Venues)表服务实现类
 *
 * @author makejava
 * @since 2021-03-24 08:45:45
 */
@Service("venuesService")
public class VenuesServiceImpl implements VenuesService {
    @Resource
    private VenuesDao venuesDao;

    /**
     * 通过ID查询单条数据
     *
     * @param venuesid 主键
     * @return 实例对象
     */
    @Override
    public Venues queryById(Long venuesid) {
        return this.venuesDao.queryById(venuesid);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<Venues> queryAllByLimit(int offset, int limit) {
        return this.venuesDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param venues 实例对象
     * @return 实例对象
     */
    @Override
    public Venues insert(Venues venues) {
        this.venuesDao.insert(venues);
        return venues;
    }

    /**
     * 修改数据
     *
     * @param venues 实例对象
     * @return 实例对象
     */
    @Override
    public Venues update(Venues venues) {
        this.venuesDao.update(venues);
        return this.queryById(venues.getVenuesid());
    }

    /**
     * 通过主键删除数据
     *
     * @param venuesid 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long venuesid) {
        return this.venuesDao.deleteById(venuesid) > 0;
    }
}
